package com.yet.source;

import java.util.Map;

import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
import org.springframework.core.env.PropertySourcesPropertyResolver;
import org.springframework.util.PropertyPlaceholderHelper;
import org.springframework.util.SystemPropertyUtils;

public class PropertySourcesPropertyResolverHolder {

	public static final String PLACEHOLDERPREFIX = "@{";

	private static final MutablePropertySources propertySources = new MutablePropertySources();

	public static PropertySourcesPropertyResolver resolver;

	public static PropertyPlaceholderHelper strictHelper;
	
	public static void init(PropertySource<Map<String, Object>> propertySource) {
		propertySources.addFirst(propertySource);
		resolver = new PropertySourcesPropertyResolver(propertySources);
		resolver.setPlaceholderPrefix(PLACEHOLDERPREFIX);
		strictHelper = new PropertyPlaceholderHelper(PLACEHOLDERPREFIX, SystemPropertyUtils.PLACEHOLDER_SUFFIX,
				SystemPropertyUtils.VALUE_SEPARATOR, false);
	}

}
